package com.benio.ycfdisplayer.fresco;

import android.content.Context;

import com.benio.ycfdisplayer.displayer.Initializer;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.core.ImagePipelineConfig;

/**
 * Fresco初始化操作
 * Created by zhangzhibin on 2016/11/3.
 */
public class FrescoInitializer implements Initializer {
    @Override
    public void initialize(Context context) {
        if (!Fresco.hasBeenInitialized()) {
            // 使用applicationContext防止内存泄露
            final Context applicationContext = context.getApplicationContext();
            ImagePipelineConfig imagePipelineConfig = ImagePipelineConfig.newBuilder(applicationContext)
                    .build();
            Fresco.initialize(applicationContext, imagePipelineConfig);
        }
    }
}
